home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / gfx / x11 / xmountains.lha / src / crinkle.h < prev    next >
C/C++ Source or Header  |  2003-06-13  |  3KB  |  92 lines

  1. /* $Id: crinkle.h,v 2.3 1994/12/06 19:40:56 spb Exp $ */
  2. #ifndef CRINKLE
  3. #define CRINKLE
  4. /*{{{  typedefs */
  5. typedef float Height;
  6. typedef float Length;
  7. /*}}}*/
  8. /*{{{  defines */
  9. #ifndef NULL
  10. #define NULL (void *) 0
  11. #endif
  12. #ifndef FALSE
  13. #define FALSE 0
  14. #define TRUE 1
  15. #endif
  16.  
  17. #define START 0
  18. #define STORE 1
  19.  
  20. #define NSTRIP 8
  21. /*}}}*/
  22. /*{{{  structs */
  23. /* strip of altitudes */
  24. typedef struct strip{
  25.   int level;
  26.   Height *d;    /* should have 2^level + 1 points */
  27. }Strip;
  28.  
  29. /* parameters for the update */
  30. typedef struct parm{
  31.   Height mean;              /* mean altitude */
  32.   int rg1;                  /* optional regeneration steps */
  33.   int rg2;
  34.   int rg3;
  35.   int cross;                /* use four point average on edges rather than 2 */
  36.   int force_front;          /* keep front edge low */
  37.   int force_back;           /* keep back edge low */
  38.   Height forceval;          /* value to force to */
  39.   float mix;                /* fraction of old value to include in average */
  40.   float midmix;             /* same but for cross updates */
  41.   float fdim;
  42. }Parm;
  43.  
  44. /* The parameter struct for the recursive procedure */
  45. typedef struct fold{
  46.   int level;                /* levels of recursion below us */
  47.   Length scale;             /* scale factor for perturbations */
  48.   Length midscale;          /* as above but for diagonal offsets */
  49.   struct parm *p;           /* update parameters */
  50.   struct strip *s[NSTRIP];  /* pointers to the pipeline strips */
  51.   struct strip *save;       /* save position for STORE state */
  52.   int stop;                 /* level to stop recursion */
  53.   int state;                /* internal stat of algorithm */
  54.   struct fold *next;        /* next iteration down */
  55. } Fold;
  56. /*}}}*/
  57. /*{{{  prototypes */
  58. #ifdef ANSI
  59. Strip *make_strip (int );
  60. void free_strip (Strip *);
  61. Strip *double_strip (Strip *);
  62. Strip *set_strip (int , Height );
  63. Strip *next_strip (Fold *);
  64. Fold *make_fold (Parm *,int, int, Length)
  65. void free_fold (Fold *);
  66. Length gaussian ();
  67. void x_update(int, float, float, Strip *, Strip *, Strip *);
  68. void p_update(int, float, float, Strip *, Strip *, Strip *);
  69. void t_update(int, float, float, Strip *, Strip *, Strip *);
  70. void v_update(int, float, float, Strip *, Strip *, Strip *);
  71. void vside_update(int, float, float, Strip *);
  72. void hside_update(int, float, float, Strip *, Strip *, Strip *);
  73. #else
  74. Strip *make_strip ();
  75. void free_strip ();
  76. Strip *double_strip ();
  77. Strip *set_strip ();
  78. Strip *next_strip ();
  79. Fold *make_fold ();
  80. void free_fold ();
  81. Length gaussian ();
  82. void x_update();
  83. void p_update();
  84. void t_update();
  85. void v_update();
  86. void vside_update();
  87. void hside_update();
  88.  
  89. #endif
  90. /*}}}*/
  91. #endif
  92.